package net.lab1024.sa.admin.module.business.file.controller;

import net.lab1024.sa.admin.module.business.file.domain.entity.DocmentPrintEntity;
import net.lab1024.sa.admin.module.business.file.domain.form.add.DocmentaAddForm;
import net.lab1024.sa.admin.module.business.file.domain.form.query.DocmentaQueryForm;
import net.lab1024.sa.admin.module.business.file.domain.form.update.DocmentaUpdateForm;
import net.lab1024.sa.admin.module.business.file.domain.vo.DocmentaVO;
import net.lab1024.sa.admin.module.business.file.service.DocmentaService;
import net.lab1024.sa.admin.util.CmdExecutor;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import cn.dev33.satoken.annotation.SaCheckPermission;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.print.PrintService;
import javax.validation.Valid;
import java.util.Set;

import static org.aspectj.weaver.tools.cache.SimpleCacheFactory.path;

/**
 * 生产订单与机器对应表 Controller
 *
 * @Author AKITA
 * @Date 2025-07-04 16:56:25
 * @Copyright AKITA
 */

@RestController
@Tag(name = "生产订单与机器对应表")
public class DocmentaController {

    @Resource
    private DocmentaService docmentaService;


    @PostMapping("/docmenta/queryPage")
    public ResponseDTO<PageResult<DocmentaVO>> queryPage(@RequestBody @Valid DocmentaQueryForm queryForm) {
        return ResponseDTO.ok(docmentaService.queryPage(queryForm));
    }


    @PostMapping("/docmenta/add")
    public ResponseDTO<String> add(@RequestBody @Valid DocmentaAddForm addForm) {
        return docmentaService.add(addForm);
    }


    @PostMapping("/docmenta/update")
    public ResponseDTO<String> update(@RequestBody @Valid DocmentaUpdateForm updateForm) {
        return docmentaService.update(updateForm);
    }


    @PostMapping("/docmenta/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return docmentaService.batchDelete(idList);
    }

    @GetMapping("/docmenta/delete/{docEntry}")
    public ResponseDTO<String> batchDelete(@PathVariable Long docEntry) {
        return docmentaService.delete(docEntry);
    }



    @PostMapping("/docmenta/print")
    public ResponseDTO<String> print(@RequestBody  DocmentaQueryForm queryForm) throws Exception {
        return docmentaService.print(queryForm);
    }
    //文件打印--所有人都可以使用的
    @PostMapping("/docmenta/printNoRole")
    public ResponseDTO<String> printNoRole(@RequestBody  DocmentaQueryForm queryForm) throws Exception {
        return docmentaService.printNoRole(queryForm);
    }

    @PostMapping("/docmenta/selectPrint")
    public ResponseDTO<PageResult<DocmentPrintEntity>> selectPrint(@RequestBody  DocmentaQueryForm queryForm) throws Exception {
        return ResponseDTO.ok(docmentaService.selectPrint(queryForm));
    }

    @GetMapping("/docmenta/printlist")
    public ResponseDTO<Set<String>> printlist() {
        return docmentaService.printlist();
    }


    @GetMapping("/docmenta/macList")
    public ResponseDTO<PrintService[]> macList() {
        return docmentaService.macList();
    }



}
